package org.ala.distributed_transaction_test.test_1.dao;

import java.util.List;

import java.util.Collection;
import org.apache.ibatis.annotations.Mapper;
import org.ala.distributed_transaction_test.test_1.update.Test1BatchUpdate;
import org.ala.distributed_transaction_test.test_1.entity.Test1DO;
import org.ala.distributed_transaction_test.test_1.query.Test1Query;
import org.apache.ibatis.annotations.Param;
//import com.hupun.calf.db.dao.annotation.Pagement;
//import com.hupun.calf.entity.Page;
//import com.hupun.calf.query.QueryBase;


/**
 *	Dao (test_1)
 *  
 *	@author 骆毅 (ala)
 *  @date 2024-02-17 11:44:18
 */
@Mapper
public interface Test1Mapper {


	/**
	 *  find all records
	 */
	List<Test1DO> findAll();
	
	/**
	 * find records by querys
	 *
	 * @param query		multiple query means 'or'
	 *
	 * @return records by query
	 */
	List<Test1DO> findByQuery(@Param("querys") Test1Query... query);
	
	/**
	 * find count by querys
	 * 
	 * @param query		multiple query means 'or'
	 *
	 * @return count by query
	 */
	Integer findCount(@Param("querys") Test1Query... query);
	
	/**
	 * find records by querys with page
	 *
	 * @param page		offset/limit parameters
	 * @param query		multiple query means 'or'
	 *
	 * @return records by query with page
	 */
//	@Pagement(count = "findCount", value = "findByPage")
//	Page<Test1DO> findByPage(@Param("page") QueryBase page, @Param("querys") Test1Query... query);


	/**
	 * get singleton record by the unique PRIMARY KEY
	 * 
	 * @param id		the unique PRIMARY KEY, with only one FIELD 'id'
	 *
	 * @return the singleton record by id
	 */
	Test1DO getById(Long id);


	/**
	 * update singleton record by entity
	 *
	 * @param entity	the entity 
	 */
	Integer updateById(Test1DO entity);
	/**
	 *	
	 */
	Integer update(@Param("value") Test1DO value, @Param("querys") Test1Query... query);
	/**
	 *	
	 */
	Integer batchUpdate(@Param("update") Test1BatchUpdate update);
	
	
	/**
	 *	incrment id in 'id' field
	 */
	void insert(Test1DO test1DO);
	/**
	 *	batch_insert
	 */
	void batchInsert(@Param("list") Collection<Test1DO> list);

	
	/**
	 *
	 */
	Integer deleteById(@Param("id") Long id);
	/**
	 *
	 */
	Integer delete(@Param("querys") Test1Query... query);
	
}
